package cn.pink.dbsrv;
                    
import cn.pink.core.Service;
import cn.pink.core.gen.proxy.RPCImplBase;
import cn.pink.dbsrv.RPCProxy.DBServiceProxy.EnumCall;
import cn.pink.core.support.function.*;
import java.util.Map;
import java.util.Set;
import cn.pink.core.gen.IronGenFile;

@SuppressWarnings({ "unchecked", "rawtypes" })
@IronGenFile
public final class DBServiceImpl extends RPCImplBase {
	
	/**
	 * 获取函数指针
	 */
	@Override	
	public Object getMethodFunction(Service service, int methodKey) {
		DBService serv = (DBService)service;
		switch (methodKey) {
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_CACHEPERSIST_STRING_STRING_BYTES: {
						return (IronFunctionWithReturn3<String, String, byte[]>)serv::cachePersist;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_DEFAULTHANDLER_STRING: {
						return (IronFunctionWithReturn1<String>)serv::defaultHandler;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_UPDATE_STRING_MAP_SET: {
						return (IronFunctionWithReturn3<String, Map, Set>)serv::update;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_CACHELOAD_STRING: {
						return (IronFunctionWithReturnAsync1<String>)serv::cacheLoad;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_FINDHUMAN_STRING: {
						return (IronFunctionWithReturnAsync1<String>)serv::findHuman;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_IDALLOT_LONG: {
						return (IronFunctionWithReturnAsync1<Long>)serv::idAllot;
			}
			default: break;
		}
		
		return null;
	}

	@Override
	public int getMethodLock(Service service, int methodKey) {
		switch (methodKey) {
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_CACHEPERSIST_STRING_STRING_BYTES: {
				return -1;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_DEFAULTHANDLER_STRING: {
				return -1;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_UPDATE_STRING_MAP_SET: {
				return -1;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_CACHELOAD_STRING: {
				return -1;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_FINDHUMAN_STRING: {
				return -1;
			}
			case EnumCall.CN_PINK_DBSRV_DBSERVICE_IDALLOT_LONG: {
				return -1;
			}
			default: break;
		}

		return -1;
	}
}
